package com.lehecai.core.api.event;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lehecai.core.IntegerBeanLabelItem;

/**
 * 道具兑换卡状态
 * @author He Wang
 *
 */
public class PropExchangeCardStatus extends IntegerBeanLabelItem {
	private static final Logger logger = LoggerFactory.getLogger(PropExchangeCardStatus.class.getName());
	private static final long serialVersionUID = -2655180046354667807L;
	
	private static List<PropExchangeCardStatus> items = new ArrayList<PropExchangeCardStatus>();
	private static List<PropExchangeCardStatus> queryItems = new ArrayList<PropExchangeCardStatus>();
	
	protected PropExchangeCardStatus(String name, int value, boolean queryOnly) {
		super(PropExchangeCardStatus.class.getName(), name, value);
		queryItems.add(this);
		if (!queryOnly) {
			items.add(this);
		}
	}
	
	protected PropExchangeCardStatus(String name, int value) {
		this(name, value, false);
	}
	
	public static PropExchangeCardStatus getItem(int value){
		try {
			return (PropExchangeCardStatus)PropExchangeCardStatus.getResult(PropExchangeCardStatus.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<PropExchangeCardStatus> getItems() {
		return items;
	}
	
	public static List<PropExchangeCardStatus> getQueryItems() {
		return queryItems;
	}

	public static final PropExchangeCardStatus ALL = new PropExchangeCardStatus("全部", -1, true);
	public static final PropExchangeCardStatus NOT_ACTIVE = new PropExchangeCardStatus("未激活", 0);
	public static final PropExchangeCardStatus AVAILABLE = new PropExchangeCardStatus("可用", 1);
	public static final PropExchangeCardStatus DISABLED = new PropExchangeCardStatus("已禁用", 2);
	public static final PropExchangeCardStatus USED = new PropExchangeCardStatus("已使用", 3);
}
